/**
 * @ClassName LC509
 * @Author ykx
 * @Date 2024/3/30 13:03
 * @Version 1.0
 */
public class LC509 {
    public static void main(String[] args) {

    }

    public boolean checkPerfectNumber(int num) {
        int sum = 0;
        for (int i = 1; i <= num / 2; i++) {
            if (num % i == 0) {
                sum += i;
            }
            if (sum > num) {
                break;
            }
        }
        return sum == num;
    }
}
